﻿using System;

namespace Char
{
    class Program
    {
        static void Main(string[] args)
        {
            var info ="  字符  串  ";
            Console.WriteLine(info);
            var netInfo = info.Trim(' ');
            Console.WriteLine(netInfo);
            int ind = info.IndexOf("符");
            Console.WriteLine(info.Remove(ind+1,2));
            int ins = info.IndexOf("字");
            Console.WriteLine(info.Remove(ind + 1, 2));
            Console.WriteLine(info.StartsWith(" "));

            

            var str1 = " 1111";
            var str2 = "  2222";
            Console.WriteLine(str1.PadLeft(6));
            Console.WriteLine(str2);



            string str = "57488574854549";
            Console.WriteLine("字符串的长度为：" + str.Length);
            Console.WriteLine("字符串中第一个字符为：" + str[0]);
            Console.WriteLine("字符串中最后一个字符为：" + str[str.Length - 1]);

            //插入  
            str = str.Insert(0, "464");
            Console.WriteLine("新字符：" + str);

            //倒输出
            for (int i = str.Length - 1; i >= 0; i--)
            {
                Console.Write(str[i]);
            }

            //寻找9
            if (str.IndexOf("9") != -1)
            {
                Console.WriteLine("字符串中含有9，其出现的位置是{0}", str.IndexOf("9") + 1);
            }
            else
            {
                Console.WriteLine("字符串中不含有9");
            }

            
        }

    }
}
